package org.googlecode.openapi_java;

import org.json.JSONException;
import org.json.JSONObject;

public class WallPost {
	private Media media;
	private long fromId;
	private long toId;
	private long date;
	private String text;
	private int online;
	private long id;

	public static WallPost fromJSON(JSONObject jPost) throws JSONException {
		WallPost wallPost = new WallPost();
		wallPost.fromId = jPost.getLong("from_id");
		wallPost.toId = jPost.getLong("to_id");
		wallPost.id = jPost.getLong("id");
		wallPost.online = jPost.getInt("online");
		wallPost.text = jPost.getString("text");
		wallPost.date = jPost.getLong("date");
		JSONObject jMedia = jPost.getJSONObject("media");
		
		return wallPost;
	}

}
